<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../style/ucs.css">
    <link rel="stylesheet" href="../content/font/iconfont.css">
    <link rel="stylesheet" href="../style/theme.css">
</head>
<body>
    <div id="giraffe"></div>
    <script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
    <script type="text/javascript" src="../../dist/libs/engine.js"></script>
    <script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>

    <script type="text/javascript">
        //个人实名信息
        var realNameInfoDM = new UDM({
            value:{
                IsNew:0, //是否有新消息
                AccType:0,
                Mobile:"",
                IsBindMobile:false,//是否绑定手机
                BindMobileUrl:"../UserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../UserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../MyBankCard/index.html",//绑卡链接
                Current:"InvestList",  //当前选中菜单
                InvestAccountUrl:"../MyAccount/index.html",//投资账户总览链接
                InvestListUrl:"../MyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../MyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../UserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../UserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../FinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../FinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../AccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../CompanyMessageCenter/index.html"//融资消息中心
            }
        })
        //分页条模型
        var paginationDM = new UDM({
            value: {	//默认值为0
                totalPage: 0,	//总页数
                pageSize: 2,	//每页显示条数
                curPage: 1	//当前页码
            },
            onClick:function(v){
                ajaxFn()
            }
        });

        //筛选条件模型

        var datePickerSearchDM = new UDM({
            value: {
                startTime:'',
                endTime:'',
                label:'投资时间：',
                connect:'至'
            },
            onChange:function (start,end) {
                console.log(start+end)
            }
        })
        var stautsOptionDM = new UDM({
            value:{
                selectIndex:null,
                selectValue:'2',
                selectText:'',
                options:[
                {
                    option: "所有项目",
                    value: "-1"
                },
                {
                    option: "还款中",
                    value: "1"
                },
                {
                    option: "投标失败，已退款",
                    value: "2"
                }
            ]},
            onChange: function (v) {
                //执行ajax请求
                console.log(v)
            }
        })

        //投资记录模型
        var investRecordDM = new UDM({
            value:{
                list:[
//                    {
//                        ProjectUrl:"", //项目详情链接
//                        ProjectName:  "",//项目名称
//                        PayAmount:  "",	//投资金额
//                        Income:  "",	//预期收益
//                        ValueBegin:"",	//项目起息日
//                        RepayBegin: "",	//项目到期日
//                        UserCenterOrderStatus: 0//投资记录状态
//                    }
                ],
                noPrecedent:-1    //1:代表从未投资过 0：代表投资过，筛选条件无结果 -1：代表空白
            },
            goInvestUrl:"../InvestList/index.html"
        })

        //模拟后台返回数据
        var listValue = [
            {
                ProjectUrl:"../MyInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名称
                PayAmount:  "644444.30",	//投资金额
                Income:  "360",	//预期收益
                ValueBegin:"2017-01-20",	//项目起息日
                RepayBegin: "2017-03-20",	//项目到期日
                UserCenterOrderStatus: 20//投资记录状态
            },
            {
                ProjectUrl:"../MyInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名称
                PayAmount:  "644444.30",	//投资金额
                Income:  "360",	//预期收益
                ValueBegin:"2017-01-20",	//项目起息日
                RepayBegin: "2017-03-20",	//项目到期日
                UserCenterOrderStatus: 20
            },
            {
                ProjectUrl:"../MyInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名称
                PayAmount:  "634535435.30",	//投资金额
                Income:  "360",	//预期收益
                ValueBegin:"2017-01-20",	//项目起息日
                RepayBegin: "2017-03-20",	//项目到期日
                UserCenterOrderStatus: 20
            },
            {
                ProjectUrl:"../MyInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名称
                PayAmount:  "63452345.30",	//投资金额
                Income:  "360",	//预期收益
                ValueBegin:"2017-01-20",	//项目起息日
                RepayBegin: "2017-03-20",	//项目到期日
                UserCenterOrderStatus: 60
            },
            {
                ProjectUrl:"../MyInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名称
                PayAmount:  "634525435.30",	//投资金额
                Income:  "360",	//预期收益
                ValueBegin:"2017-01-20",	//项目起息日
                RepayBegin: "2017-03-20",	//项目到期日
                UserCenterOrderStatus: 10
            }
        ];
        var ajaxFn = function () {
            var pageSize = paginationDM.getValue().pageSize;	//获取每页显示条数
            var curPage = paginationDM.getValue().curPage;		//获取当前选中页码

            var curListValue = [];

            var paginationValue = {
                totalPage: Math.ceil(listValue.length/pageSize),	//总页数
                pageSize: pageSize,	//每页显示条数
                curPage: curPage	//当前页码
            }

            if(listValue.length>0){
                for(var i = curPage*pageSize - pageSize ; i < curPage*pageSize ; i ++){
                    if(listValue[i]){
                        curListValue.push(listValue[i]);
                    }
                }
            }
            /*个人实名信息*/
            var realName = {
                AccType:0,
                Mobile:"155****2132",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../UserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../UserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../MyBankCard/index.html",//绑卡链接
                Current:"InvestList",  //当前选中菜单
                InvestAccountUrl:"../MyAccount/index.html",//投资账户总览链接
                InvestListUrl:"../MyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../MyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../UserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../UserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../FinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../FinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../AccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../CompanyMessageCenter/index.html"//融资消息中心
            };

            realNameInfoDM.setValue(realName);
            setTimeout(function () {
                investRecordDM.setValue({list:curListValue});
                paginationDM.setValue(paginationValue);
            },2000)

        }
        var PageDM = {
            pagination: paginationDM,
            investRecord: investRecordDM,
            datePickerSearch: datePickerSearchDM,
            stautsOption: stautsOptionDM,
            realNameInfo: realNameInfoDM
        }
        UEventHub.on('pageLoad', function(v){
            ajaxFn();
            console.log(stautsOptionDM.getValue());
        });
    </script>
<script type="text/javascript" src="../MyInvest\index.js"></script></body>
</html>